package com.example.design.factory.phone.simple;

import com.example.design.factory.phone.simple.abstractproduct.Phone;
import com.example.design.factory.phone.simple.abstractproduct.ApplePhone;
import com.example.design.factory.phone.simple.factory.PhoneFactory;

/**
 * @Description 简单工厂模式测试类
 * @ClassName SimpleFactoryTest
 * @Author Administrator
 * @Date 2020/5/13 19:25
 * @Version 1.0.0
 */
public class SimpleFactoryTest {
    public static void main(String[] args) {

        PhoneFactory factory = new PhoneFactory();

        Phone phone = factory.makePhone("MiPhone");

        ApplePhone iphone = (ApplePhone) factory.makePhone("ApplePhone");

        // 报错，生产的手机类型和强转的类型不一致
//        MiPhone phone1 = (MiPhone) factory.makePhone("ApplePhone");
    }
}
